/*   1:    */ package org.intellij.images.options.impl;
/*   2:    */ 
/*   3:    */

import com.intellij.openapi.util.JDOMExternalizable;
import com.intellij.openapi.util.JDOMExternalizer;
import org.intellij.images.options.TransparencyChessboardOptions;
import org.jdom.Element;

import java.awt.*;
import java.beans.PropertyChangeSupport;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */ 
/*  10:    */ final class TransparencyChessboardOptionsImpl
/*  11:    */   implements TransparencyChessboardOptions, JDOMExternalizable
/*  12:    */ {
/*  13: 32 */   private boolean a = true;
/*  14: 33 */   private int b = 5;
/*  15: 34 */   private Color c = DEFAULT_WHITE_COLOR;
/*  16: 35 */   private Color d = DEFAULT_BLACK_COLOR;
/*  17:    */   private final PropertyChangeSupport e;
/*  18:    */   
/*  19:    */   TransparencyChessboardOptionsImpl(PropertyChangeSupport paramPropertyChangeSupport)
/*  20:    */   {
/*  21: 39 */     this.e = paramPropertyChangeSupport;
/*  22:    */   }
/*  23:    */   
/*  24:    */   public boolean isShowDefault()
/*  25:    */   {
/*  26: 43 */     return this.a;
/*  27:    */   }
/*  28:    */   
/*  29:    */   public int getCellSize()
/*  30:    */   {
/*  31: 47 */     return this.b;
/*  32:    */   }
/*  33:    */   
/*  34:    */   public Color getWhiteColor()
/*  35:    */   {
/*  36: 51 */     return this.c;
/*  37:    */   }
/*  38:    */   
/*  39:    */   public Color getBlackColor()
/*  40:    */   {
/*  41: 55 */     return this.d;
/*  42:    */   }
/*  43:    */   
/*  44:    */   void setShowDefault(boolean paramBoolean)
/*  45:    */   {
/*  46: 59 */     boolean bool = this.a;
/*  47: 60 */     if (bool != paramBoolean)
/*  48:    */     {
/*  49: 61 */       this.a = paramBoolean;
/*  50: 62 */       this.e.firePropertyChange("Editor.TransparencyChessboard.showDefault", bool, this.a);
/*  51:    */     }
/*  52:    */   }
/*  53:    */   
/*  54:    */   void setCellSize(int paramInt)
/*  55:    */   {
/*  56: 67 */     int i = this.b;
/*  57: 68 */     if (i != paramInt)
/*  58:    */     {
/*  59: 69 */       this.b = paramInt;
/*  60: 70 */       this.e.firePropertyChange("Editor.TransparencyChessboard.cellSize", i, this.b);
/*  61:    */     }
/*  62:    */   }
/*  63:    */   
/*  64:    */   void setWhiteColor(Color paramColor)
/*  65:    */   {
/*  66: 75 */     Color localColor = this.c;
/*  67: 76 */     if (paramColor == null) {
/*  68: 77 */       this.c = DEFAULT_WHITE_COLOR;
/*  69:    */     }
/*  70: 79 */     if (!localColor.equals(paramColor))
/*  71:    */     {
/*  72: 80 */       this.c = paramColor;
/*  73: 81 */       this.e.firePropertyChange("Editor.TransparencyChessboard.whiteColor", localColor, this.c);
/*  74:    */     }
/*  75:    */   }
/*  76:    */   
/*  77:    */   void setBlackColor(Color paramColor)
/*  78:    */   {
/*  79: 86 */     Color localColor = this.d;
/*  80: 87 */     if (paramColor == null) {
/*  81: 88 */       paramColor = DEFAULT_BLACK_COLOR;
/*  82:    */     }
/*  83: 90 */     if (!localColor.equals(paramColor))
/*  84:    */     {
/*  85: 91 */       this.d = paramColor;
/*  86: 92 */       this.e.firePropertyChange("Editor.TransparencyChessboard.blackColor", localColor, this.d);
/*  87:    */     }
/*  88:    */   }
/*  89:    */   
/*  90:    */   public void inject(TransparencyChessboardOptions paramTransparencyChessboardOptions)
/*  91:    */   {
/*  92: 97 */     setShowDefault(paramTransparencyChessboardOptions.isShowDefault());
/*  93: 98 */     setCellSize(paramTransparencyChessboardOptions.getCellSize());
/*  94: 99 */     setWhiteColor(paramTransparencyChessboardOptions.getWhiteColor());
/*  95:100 */     setBlackColor(paramTransparencyChessboardOptions.getBlackColor());
/*  96:    */   }
/*  97:    */   
/*  98:    */   public boolean setOption(String paramString, Object paramObject)
/*  99:    */   {
/* 100:104 */     if ("Editor.TransparencyChessboard.showDefault".equals(paramString)) {
/* 101:105 */       setShowDefault(((Boolean)paramObject).booleanValue());
/* 102:106 */     } else if ("Editor.TransparencyChessboard.cellSize".equals(paramString)) {
/* 103:107 */       setCellSize(((Integer)paramObject).intValue());
/* 104:108 */     } else if ("Editor.TransparencyChessboard.whiteColor".equals(paramString)) {
/* 105:109 */       setWhiteColor((Color)paramObject);
/* 106:110 */     } else if ("Editor.TransparencyChessboard.blackColor".equals(paramString)) {
/* 107:111 */       setBlackColor((Color)paramObject);
/* 108:    */     } else {
/* 109:113 */       return false;
/* 110:    */     }
/* 111:115 */     return true;
/* 112:    */   }
/* 113:    */   
/* 114:    */   public void readExternal(Element paramElement)
/* 115:    */   {
/* 116:119 */     setShowDefault(JDOMExternalizer.readBoolean(paramElement, "Editor.TransparencyChessboard.showDefault"));
/* 117:120 */     setCellSize(JDOMExternalizer.readInteger(paramElement, "Editor.TransparencyChessboard.cellSize", 5));
/* 118:121 */     setWhiteColor(JDOMExternalizerEx.readColor(paramElement, "Editor.TransparencyChessboard.whiteColor", DEFAULT_WHITE_COLOR));
/* 119:122 */     setBlackColor(JDOMExternalizerEx.readColor(paramElement, "Editor.TransparencyChessboard.blackColor", DEFAULT_BLACK_COLOR));
/* 120:    */   }
/* 121:    */   
/* 122:    */   public void writeExternal(Element paramElement)
/* 123:    */   {
/* 124:126 */     JDOMExternalizer.write(paramElement, "Editor.TransparencyChessboard.showDefault", this.a);
/* 125:127 */     JDOMExternalizer.write(paramElement, "Editor.TransparencyChessboard.cellSize", this.b);
/* 126:128 */     JDOMExternalizerEx.write(paramElement, "Editor.TransparencyChessboard.whiteColor", this.c);
/* 127:129 */     JDOMExternalizerEx.write(paramElement, "Editor.TransparencyChessboard.blackColor", this.d);
/* 128:    */   }
/* 129:    */   
/* 130:    */   public boolean equals(Object paramObject)
/* 131:    */   {
/* 132:133 */     if (this == paramObject) {
/* 133:134 */       return true;
/* 134:    */     }
/* 135:136 */     if (!(paramObject instanceof TransparencyChessboardOptions)) {
/* 136:137 */       return false;
/* 137:    */     }
/* 138:140 */     TransparencyChessboardOptions localTransparencyChessboardOptions = (TransparencyChessboardOptions)paramObject;
/* 139:    */     
/* 140:142 */     return (this.b == localTransparencyChessboardOptions.getCellSize()) && (this.a == localTransparencyChessboardOptions.isShowDefault()) && (this.d != null ? this.d.equals(localTransparencyChessboardOptions.getBlackColor()) : localTransparencyChessboardOptions.getBlackColor() == null) && (this.c != null ? this.c.equals(localTransparencyChessboardOptions.getWhiteColor()) : localTransparencyChessboardOptions.getWhiteColor() == null);
/* 141:    */   }
/* 142:    */   
/* 143:    */   public int hashCode()
/* 144:    */   {
/* 145:155 */     int i = this.a ? 1 : 0;
/* 146:156 */     i = 29 * i + this.b;
/* 147:157 */     i = 29 * i + (this.c != null ? this.c.hashCode() : 0);
/* 148:158 */     i = 29 * i + (this.d != null ? this.d.hashCode() : 0);
/* 149:159 */     return i;
/* 150:    */   }
/* 151:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.images.options.impl.TransparencyChessboardOptionsImpl

 * JD-Core Version:    0.7.0.1

 */